How to Write a Case Statement

The case statement in Oracle is really easy to use, let’s take a look to the next example:

select 
	case
		when salary >= 100000 and salary<200000 then '100k'
		when salary >= 200000 then 'more than 200k'
		else 'under_100k'
	end AS salary_level,
	case
		when dep_id IN (120,121) then 'admin'
		when dep_id IN (100,101) then 'tech'
		else 'other'
	end AS tasks
from employee;

IN THIS PAGE